<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>案例1</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }
        
        ul {
            width: 44px;
            border: 1px solid orange;
        }
        
        li {
            padding: 5px;
            cursor: pointer;
        }
        
        li:hover {
            background-color: rgba(255, 166, 0, 0.397);
        }
        
        .div1 {
            display: none;
        }
    </style>
</head>

<body>
    <div style="width: 100px;margin: 50px auto;position: relative;">
        <button onclick="dd.style.display='block'">输入法</button>
        <div class="div1" style="position: absolute;">
            <ul>
                <li>拼音</li>
                <li>手写</li>
                <li onclick="dd.style.display='none'">关闭</li>
            </ul>
        </div>
    </div>
    <script>
        let dd = document.querySelector('.div1')
    </script>

</body>

</html>